<?php
include_once 'paperblog.php';
checkLogin();
$categorys = getCategorys();
$tags = getTags();
$settings = getSettings();
?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>添加文章</title>
    <link href="resources/css/common.css" rel="stylesheet" />
    <script src="<?php echo $settings['base'] ?>/admin/resources/kindeditor/kindeditor.js"></script>
    <script src="<?php echo $settings['base'] ?>/admin/resources/kindeditor/lang/zh_CN.js"></script>
    <script>
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('#content');
        });
    </script>
</head>
<body>
    <form action="action/add.action.php" method="POST" class="common-form">
        <div>
            <label for="url">URL</label>
            <input type="text" name="url" id="url" style="width: 300px;" /><span class="tips">用于生成HTML文件，必须唯一，保存后不能更改，例如(this_is_my_first_post)</span>
        </div>
        <div>
            <label for="title">标题</label>
            <input type="text" name="title" id="title" style="width: 300px;" />
        </div>
        <div>
            <label for="category">分类</label>
            <select name="category" id="category">
                <?php
                foreach ($categorys as $id => $category) {
                ?>
                <option value="<?php echo $id ?>"><?php echo $category['name'] ?></option>
                <?php
                }
                ?>
            </select>
        </div>
        <div>
            <label for="tags">标签</label>
            <input type="text" name="tags" id="tags" style="width: 300px;" /><span class="tips">请用英文逗号分割</span>
        </div>
        <div>
            <label for="content" style="display: none;">内容</label>
            <textarea id="content" name="content" style="width: 720px; height: 300px;"></textarea>
        </div>
        <div>
            <input type="submit" value="提交" /><a href="index.php" style="margin-left: 10px;">返回管理主页</a>
        </div>
    </form>
</body>
</html>
